package com.example.demo.quant;

import com.example.demo.mapper.RaceLogMapper;
import com.example.demo.mapper.RaceMapper;
import com.example.demo.quant.impl.RandomDataProvider;
import com.example.demo.quant.impl.RandomStrategy;
import jakarta.annotation.Resource;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.test.context.junit4.SpringRunner;

@RunWith(SpringRunner.class)
@SpringBootTest
public class _Main_TEST_ {
    @Resource
    private RaceMapper raceMapper;

    @Resource
    private RaceLogMapper raceLogMapper;

    @Test
    public void main() {
        DataProvider dataProvider = new RandomDataProvider(); // 提供数据
        Strategy strategy = new RandomStrategy(); // 策略

        QuantRace quantRace = new QuantRace();
        quantRace.setBalance(10000); // 账户余额
        quantRace.setPeriod(1000); // 每隔多久判断一次
        quantRace.setRound(1000); // 跑多少轮

        quantRace.setDataProvider(dataProvider);
        quantRace.setStrategy(strategy);

        QuantEngine engine = new QuantEngine();
        engine.setRaceMapper(this.raceMapper);
        engine.setRaceLogMapper(this.raceLogMapper);
        engine.runRace(quantRace);
    }
}
